home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DIRS.SWG / 0002_Search ALL Dirs and Subs.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  769b  |  29 lines

  1. Uses Crt, Dos, WinDos;
  2. Procedure SearchSubDirs(Dir:PathStr;Target:SearchRec);
  3. Var
  4.   FoundDir: TSearchRec;
  5.   FileSpec: PathStr;
  6.   Path : DirStr;
  7.   DummyName: NameStr;
  8.   DummyExt : ExtStr;
  9. begin
  10.  If KeyPressed then Repeat Until KeyPressed;
  11.  FileSpec:= Dir + '*.';
  12.  FindFirst('*.*', AnyFile, FoundDir);
  13.  While (DosError = 0) do
  14.    begin
  15.      With FoundDir do
  16.        begin
  17.          If Name[1] <> '.' then
  18.            if Directory and Attr <> 0 then
  19.              begin
  20.                FSplit(FileSpec,Path,DummyName,DummyExt);
  21.                FindFirst(Path + Name + '\' ,Target);
  22.              end;
  23.        end; {with FoundDir}
  24.      if KeyPressed then Pause;
  25.      FindNext(FoundDir);
  26.    end; {read loop}
  27.    If DosError <> 18 then DosErrorExit;
  28. end;
  29.